<template>
	<view class="news">
		<news-list @itemClick="goDetail" :news="news"></news-list>
		<view class="isover">--- 没有了 ---</view>
	</view>
</template>

<script>
	import newsList from "../../components/news-list/news-list.vue"
	import {getList} from '@/api/api.js';
	export default {
		data() {
			return {
				page:1,
				news:[]
			}
		},
		components:{"news-list":newsList},
		onLoad(){
			this.getNewsList()
		},
		methods: {
			async getNewsList (){
				
				await getList().then((res) => {
					console.log(res[0])
					this.news = res
				}).catch(() => {
				
				})
				// const res = await this.$myRequest({
				// 	url: '/index.php/api/index/newslist/?page='+ this.page
				// })
				// this.news = res.data.data
			},
			goDetail(id){
				uni.navigateTo({
					url:'/pages/news-detail/news-detail?id='+id
				})
			}
		}

	}
</script>

<style lang="scss">
	.news{
	background:#eee;
	}
	.isover{
		width: 100%;
		height:50px;
		line-height:50px;
		text-align: center;
		color:#999;
	}
</style>